<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link type="text/css" rel="stylesheet" href="main2.css">
    <title>单位资料维护材料补正通知书</title>
	<!--jquery -->
	<script type="text/javascript" src="../js/jquery/jquery-2.0.3.min.js" ></script>
	
	<script type="text/javascript" src="../js/share.js"></script>
<!-- 	<script type="text/javascript" src="05.js" ></script> -->
	<script type="text/javascript">
	var itemno = "";
	var applyid = "";
	var nodeno = "";
	var orgcode = "";
	var nextnodecode1 = "";
	var selectID = "userlist";
	var applyno = "";

	$(function(){
		applyno = getUrlParam("applyno");
		bindData(applyno);
	})


	function bindData(applyno){
		$.ajax({ 
			url: basePath() + 'business/getcorrectioninfo.do',
			data: {"applyno": applyno},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonApply = data.datas.apply;
		    		var jsonMaterial = data.datas.material;
		    		var jsonOpintion = data.datas.opintion;
		    		
//		    		//绑定业务资料
//		    		bindBusinessForm(jsonBusiness);
		    		
		    		//绑定附件材料
		    		bindMaterialListForm(jsonMaterial);	    
		    		

		    		bindApplyForm(jsonApply);

		    		$('#opinion').html(jsonOpintion.opinion);
		    		$('#audittime').html(formatDate(jsonOpintion.audittime, 'yyyy年mm月dd日'));
		    	}
	      	}
		});
	}

	function bindApplyForm(jsonApply){
		for(var d in jsonApply){//遍历json对象的每个key/value对,p为key
			if(d == 'applytime'){
				$('#' + d).html(formatDate(jsonApply[d], 'yyyy年mm月dd日'));
			}
			else if(d == 'nodename'){
				if(jsonApply[d] == '办结')
					$('#' + d).html('<span style="color:green;font-weight: bold;">' + jsonApply[d] + '</span>');
				else if(jsonApply[d].indexOf('补正') >= 0){
					$('#' + d).html('<span style="color:red;font-weight: bold;">' + jsonApply[d] + '</span>');
					$('#correction').show();
					$('#correction').attr('href', 'correction.html?applyno=' + applyno);
				}
				else if(jsonApply[d].indexOf('申报') >= 0){
					$('#' + d).html('<span style="color:red;font-weight: bold;">未提交</span>');
					$('#edit').show();
					$('#edit').attr('href', 'edit.html?applyno=' + applyno);
				}
	        	else if(jsonApply[d].indexOf('受理') >= 0)
	        		$('#' + d).html('<span style="color:blue; font-weight: bold;">待受理</span>');
				else{
					$('#' + d).html('<span style="color:blue;font-weight: bold;">已受理</span>');
				}
			}
			else{
				$('#' + d).html(jsonApply[d] == '' ? '/' : jsonApply[d]);
			}
		}
	}

	function bindBusinessForm(jsonBusiness){

		for(var d in jsonBusiness){//遍历json对象的每个key/value对,p为key
			if(d == 'workbegintime' || d == 'workendtime'){
				$('#' + d).html(formatDate(jsonBusiness[d], 'yyyy-mm-dd'));
			}
			else{
				$('#' + d).html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
			}
		}
	}

	function bindMaterialListForm(jsonMaterial){
		var k = 1;
		var minCount = 10;

		if(minCount < jsonMaterial.length)
			minCount = jsonMaterial.length;
		
		for(var i = 0; i < minCount; i++, k++){
			

			var quantity = "";
			var materialname = "";
			var opinion = "";
			
			if(i < jsonMaterial.length){
		//		var ismustsubmit = jsonMaterial[i]['ismustsubmit'];
		//		var ismustsubmitStr = "";
		//		var must = false;
		//		if(ismustsubmit == 1){
		//			ismustsubmitStr = '<span style="color:red;">*</span>';
		//			must = true;
		//		}
		//		var index = jsonMaterial[i]['serialnumber'];
				quantity = jsonMaterial[i]['quantity'];
				materialname = jsonMaterial[i]['materialname'];
				
				
		//		var fileid=jsonMaterial[i]['fileid']
		//		var fileurl = jsonMaterial[i]['fileurl'];
			}

			var trStr = '<tr>'+
					    '    <td class="td-1">'+k+'</td>'+
					    '    <td class="td-2">'+materialname+'</td>'+
					    '    <td class="td-1">'+quantity+'</td>';
					    if(i == 0)
					    	trStr += '	 <td class="td-1" rowspan="'+ minCount +'"></td>';
					    
				    	trStr += '</tr>';
			
			$('#material').find('tbody').append(trStr);
			
		}
	}

	</script>
	
</head>
<body>
<div class="image">
    <img src="image/msa.gif" style="float: left">
</div>
<h1>单位资料维护材料补正通知书</h1>
<div class="正文">
    <p style="text-decoration: underline;display:inline;"><br>
    	<span id="company"></span>
    </p>
    <p style="display:inline;">:</p>
    <p style="display:inline;padding-left: 40px"><br>你（船/单位）于</p>
		<span id="applytime" style="text-decoration: underline; font-size: 18px;"></span>
    <p style="display:inline;text-decoration: underline;"></p>
    <p style="display:inline;">，提交的关于</p>
    <p style="display:inline;text-decoration: underline;">
    	<span id="itemname"></span>
    </p>
    <p style="display:inline;">报备资料，缺少下列材料，请予以补正。</p>
</div>
<div style="padding-left: 40px;margin-top: 20px;  white-space: pre;" id="opinion">
</div>
<div class="印章2">
    <p style="display: inline;padding-left: 500px;font-size:14px;"></p>
    <p style="display:inline;"><span id="audittime"></span></p>
</div>
</body>
</html>